<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>优永动助手 - 交易</title>
    <link rel="stylesheet" href="/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="https://cdn.staticfile.org/font-awesome/4.7.0/css/font-awesome.css">
    <script src="https://cdn.staticfile.org/jquery/1.10.2/jquery.min.js"></script>
    <script type="text/javascript" src="/layui/layui.all.js"></script>
    <link rel="stylesheet" href="/css/jiaoyi.css">

</head>
<body>

<div class="layui-row bubai"></div>

<div class="layui-row search-main">
    <form action="/jiaoyi" method="get">
        <div class="layui-col-xs9">
            <input type="text" name="keyword" lay-verify="title" autocomplete="off" placeholder="请输入币种名称"
                   class="layui-input">
        </div>

        <div class="layui-col-xs3">
            <button type="submit" class="layui-btn searchbtn layui-btn-normal seabtn">搜索</button>
        </div>
    </form>

</div>

<div class="layui-row">
    <div class="layui-tab" lay-filter="docDemoTabBrief">
        <ul class="layui-tab-title jiaoyi-title">
            <li class="layui-this layui-col-xs3 card-li">全部</li>
            <li class="layui-col-xs3 card-li">策略循环</li>
            <li class="layui-col-xs3 card-li">单次循环</li>
            <li class="layui-col-xs3 card-li">停止补单</li>
        </ul>

        

        <div class="layui-tab-content">
            <div class="layui-tab-item layui-show jiaoyi-item">

                <div class="layui-row box-item" th:each="jiaoyi:${jiaoyiVOS}">
                    <div class="layui-col-xs1">
                        <input type="checkbox" class="item-check-box" name="jiaoyiid" th:value="${jiaoyi.id}">
                    </div>
                    <div class="layui-col-xs4" th:onclick="'javascript:toJiaoyiPage(\''+${jiaoyi.id}+'\');'">
                        <div class="layui-row bizong-name-box" th:text="${jiaoyi.getUpname()}">TRX/USDT</div>
                        <div class="layui-row bizong-shuliang" th:text="'数量:'+${jiaoyi.getchicangshuliangvo()}">数量：378.012589</div>
                    </div>

                    <div class="layui-col-xs3" th:onclick="'javascript:toJiaoyiPage(\''+${jiaoyi.id}+'\');'">
                        <div class="layui-row">
                         <div class="celue layui-col-xs8" th:text="${jiaoyi.xunhuantype}==0?'单次循环':'策略循环'"></div>
                        </div>
                        <div class="layui-row fukui">浮亏:<span class="fu-fukui" th:class="${jiaoyi.fukui}>0?'':'fu-fukui'"
                                                              th:text="${jiaoyi.getFukuiStr()}">+0.5417</span></div>
                    </div>

                    <div class="layui-col-xs2 layui-col-xs-offset1" th:onclick="'javascript:toJiaoyiPage(\''+${jiaoyi.id}+'\');'">
                        <button type="button" class="layui-btn layui-btn-danger zhangfubtn zhangfubtn-zheng"
                                th:class="${jiaoyi.zhangfu}<0?'layui-btn layui-btn-danger zhangfubtn':'layui-btn layui-btn-danger zhangfubtn zhangfubtn-zheng'"
                                th:text="${jiaoyi.getzhangfuvo()}">+2.5%
                        </button>
                    </div>
                </div>


                <div class="layui-row jiaoyi-end-tip">
                    没有更多数据了
                </div>
            </div>


            <div class="layui-tab-item jiaoyi-item">
                <div class="layui-row box-item" th:each="jiaoyi:${celuelist}" >
                    <div class="layui-col-xs1">
                        <input type="checkbox" class="item-check-box" name="jiaoyiid" th:value="${jiaoyi.bizhongid}">
                    </div>
                    <div class="layui-col-xs4" th:onclick="'javascript:toJiaoyiPage(\''+${jiaoyi.id}+'\');'">
                        <div class="layui-row bizong-name-box" th:text="${jiaoyi.getUpname()}">TRX/USDT</div>
                        <div class="layui-row bizong-shuliang" th:text="'数量:'+${jiaoyi.getchicangshuliangvo()}">数量：378.012589</div>
                    </div>

                    <div class="layui-col-xs3" th:onclick="'javascript:toJiaoyiPage(\''+${jiaoyi.id}+'\');'">
                        <div class="layui-row">
                            <div class="celue layui-col-xs8" th:text="${jiaoyi.xunhuantype}==0?'单次循环':'策略循环'"></div>
                        </div>
                        <div class="layui-row fukui">浮亏:<span class="fu-fukui" th:class="${jiaoyi.fukui}>0?'':'fu-fukui'"
                                                              th:text="${jiaoyi.getFukuiStr()}">+0.5417</span></div>
                    </div>

                    <div class="layui-col-xs2 layui-col-xs-offset1" th:onclick="'javascript:toJiaoyiPage(\''+${jiaoyi.id}+'\');'">
                        <button type="button" class="layui-btn layui-btn-danger zhangfubtn zhangfubtn-zheng"
                                th:class="${jiaoyi.zhangfu}<0?'layui-btn layui-btn-danger zhangfubtn':'layui-btn layui-btn-danger zhangfubtn zhangfubtn-zheng'"
                                th:text="${jiaoyi.getzhangfuvo()}">+2.5%
                        </button>
                    </div>
                </div>


                <div class="layui-row jiaoyi-end-tip">
                    没有更多数据了
                </div>
            </div>
            <div class="layui-tab-item jiaoyi-item">
                <div class="layui-row box-item" th:each="jiaoyi:${dancilist}">
                    <div class="layui-col-xs1">
                        <input type="checkbox" class="item-check-box" name="jiaoyiid" th:value="${jiaoyi.bizhongid}">
                    </div>
                    <div class="layui-col-xs4" th:onclick="'javascript:toJiaoyiPage(\''+${jiaoyi.id}+'\');'">
                        <div class="layui-row bizong-name-box" th:text="${jiaoyi.getUpname()}">TRX/USDT</div>
                        <div class="layui-row bizong-shuliang" th:text="'数量:'+${jiaoyi.getchicangshuliangvo()}">数量：378.012589</div>
                    </div>

                    <div class="layui-col-xs3" th:onclick="'javascript:toJiaoyiPage(\''+${jiaoyi.id}+'\');'">
                        <div class="layui-row">
                            <div class="celue layui-col-xs8" th:text="${jiaoyi.xunhuantype}==0?'单次循环':'策略循环'"></div>
                        </div>
                        <div class="layui-row fukui">浮亏:<span class="fu-fukui" th:class="${jiaoyi.fukui}>0?'':'fu-fukui'"
                                                              th:text="${jiaoyi.getFukuiStr()}">+0.5417</span></div>
                    </div>

                    <div class="layui-col-xs2 layui-col-xs-offset1" th:onclick="'javascript:toJiaoyiPage(\''+${jiaoyi.id}+'\');'">
                        <button type="button" class="layui-btn layui-btn-danger zhangfubtn zhangfubtn-zheng"
                                th:class="${jiaoyi.zhangfu}<0?'layui-btn layui-btn-danger zhangfubtn':'layui-btn layui-btn-danger zhangfubtn zhangfubtn-zheng'"
                                th:text="${jiaoyi.getzhangfuvo()}">+2.5%
                        </button>
                    </div>
                </div>


                <div class="layui-row jiaoyi-end-tip">
                    没有更多数据了
                </div>
            </div>
            <div class="layui-tab-item jiaoyi-item">
                <div class="layui-row box-item" th:each="jiaoyi:${tingzhilist}" >
                    <div class="layui-col-xs1">
                        <input type="checkbox" class="item-check-box" name="jiaoyiid" th:value="${jiaoyi.bizhongid}">
                    </div>
                    <div class="layui-col-xs4" th:onclick="'javascript:toJiaoyiPage(\''+${jiaoyi.id}+'\');'">
                        <div class="layui-row bizong-name-box" th:text="${jiaoyi.getUpname()}">TRX/USDT</div>
                        <div class="layui-row bizong-shuliang" th:text="'数量:'+${jiaoyi.getchicangshuliangvo()}">数量：378.012589</div>
                    </div>

                    <div class="layui-col-xs3" th:onclick="'javascript:toJiaoyiPage(\''+${jiaoyi.id}+'\');'">
                        <div class="layui-row">
                            <div class="celue layui-col-xs8" th:text="${jiaoyi.xunhuantype}==0?'单次循环':'策略循环'"></div>
                        </div>
                        <div class="layui-row fukui">浮亏:<span class="fu-fukui" th:class="${jiaoyi.fukui}>0?'':'fu-fukui'"
                                                              th:text="${jiaoyi.getFukuiStr()}">+0.5417</span></div>
                    </div>

                    <div class="layui-col-xs2 layui-col-xs-offset1" th:onclick="'javascript:toJiaoyiPage(\''+${jiaoyi.id}+'\');'">
                        <button type="button" class="layui-btn layui-btn-danger zhangfubtn zhangfubtn-zheng"
                                th:class="${jiaoyi.zhangfu}<0?'layui-btn layui-btn-danger zhangfubtn':'layui-btn layui-btn-danger zhangfubtn zhangfubtn-zheng'"
                                th:text="${jiaoyi.getzhangfuvo()}">+2.5%
                        </button>
                    </div>
                </div>


                <div class="layui-row jiaoyi-end-tip">
                    没有更多数据了
                </div>
            </div>
        </div>
    </div>
</div>

<div class="layui-row footer-top footer-top-hidden">
    <div class="layui-col-xs6 j-my-count">当前账户剩余USDT:
        <span th:text="${#numbers.formatDecimal(accountyue,1,6)}"></span></div>
    <div class="layui-col-xs4 layui-col-xs-offset2 j-my-piliang" id="open-foot-btn" show="1">批量设置</div>
</div>
<div class="layui-row footer-btn-main footer-btn-main-hidden">
    <div class="layui-row j-foot-tip">
        <div class="layui-col-xs12">仅针对已经勾选的所有币种进行操作</div>
    </div>
    <div class="layui-col-xs4" onclick="allxunhuancelue()">
        <div class="layui-row"><img src="/images/jiaoyi1.png" alt=""></div>
        <div class="layui-row">策略循环</div>
    </div>
    <div class="layui-col-xs4" onclick="alljiaoyishezhi()">
        <div class="layui-row"><img src="/images/jiaoyi2.png" alt=""></div>
        <div class="layui-row">交易设置</div>
    </div>
    <div class="layui-col-xs4" onclick="allqingchang()">
        <div class="layui-row"><img src="/images/jiaoyi3.png" alt=""></div>
        <div class="layui-row">清仓卖出</div>
    </div>
</div>
<input type="hidden" id="userid" th:value="${session.user.userid}">

<div th:replace="index::footer"></div>

<script type="text/javascript">


    $(function () {

        //批量设置的按钮
        $("#open-foot-btn").click(function () {

            var show = $(this).attr("show");
            if (show == 1) {//1  显示
                $(this).attr("show", 0);
                $(".footer-btn-main").removeClass("footer-btn-main-hidden");
                $(".footer-top").removeClass("footer-top-hidden");
            } else {//0  隐藏

                $(this).attr("show", 1);
                $(".footer-btn-main").addClass("footer-btn-main-hidden");
                $(".footer-top").addClass("footer-top-hidden");
            }

        });

    });

    //轮播
    layui.use(['carousel', 'form'], function () {
        var carousel = layui.carousel
            , form = layui.form;

        //图片轮播
        carousel.render({
            elem: '#test1'
            , width: '100%'
            , arrow: 'always' //始终显示箭头
            , height: '420px'
            , interval: 5000
        });
    });
    //选项卡
    layui.use('element', function () {
        var $ = layui.jquery
            , element = layui.element; //Tab的切换功能，切换事件监听等，需要依赖element模块
    });


    function toJiaoyiPage(jiaoyiid) {
        window.location = "/jiaoyi/detail?id="+jiaoyiid;
    }

    function allxunhuancelue() {
        var arraycheck = [];
        $("input[name=jiaoyiid]").each(function () {
            var state = $(this).prop('checked');
            if(state){
                arraycheck.push($(this).val());
            }
        });
        if(arraycheck.length==0){
            alert("请选择数据");
            return false;
        }
        $.ajax({
            url:"/jiaoyicelue/editxunhuanstatus2?ids="+arraycheck+"&userid="+$("#userid").val(),
            type:"GET",
            success:function (data) {
                alert(data.msg);
                if(data.code==0){
                    window.location = "/jiaoyi";
                }

            },
            error:function (data) {
                alert("请求数据失败");
            }
        });
    }
    
    function alljiaoyishezhi() {
        var arraycheck = [];
        $("input[name=jiaoyiid]").each(function () {
            var state = $(this).prop('checked');
            if(state){
                arraycheck.push($(this).val());
            }
        });


        if(arraycheck.length==0){
            alert("请选择币种");
            return false;
        }

        window.location = "/alljiaoyishezhi?bizhongids="+arraycheck;
    }
    
    function allqingchang() {
        var arraycheck = [];
        $("input[name=jiaoyiid]").each(function () {
            var state = $(this).prop('checked');
            if(state){
                arraycheck.push($(this).val());
            }
        });

        if(arraycheck.length==0){
            alert("请选择数据");
            return false;
        }
        var ismaichuall = confirm("确定卖出"+arraycheck.length+"个吗？");
        if(ismaichuall){
            $.ajax({
                url:'/jiaoyicelue/maichuall',
                type:'POST',
                traditional:true,
                dataType: 'json',
                data:{
                    ids:arraycheck
                },
                success:function (data) {
                    alert(data.msg);

                },
                error:function (data) {
                    alert("请求失败！");
                }
            });
        }



        
    }
</script>


</div>
</body>
</html>